#ifndef __HTTPS_H__
#define __HTTPS_H__

#include <string>
#include <vector>

using std::string;
using std::vector;
using std::cerr;
using std::endl;

typedef struct user_data
{
    char *content;      //raw data
    int size;           //raw data size, it will be -1 if use a file
    string fileName;    //data from a file
} user_data;

class https
{
private:
    vector<string> generalHeaders;


public:
    https() { };
    https(const vector<string> &myHeaders) 
    {
        vector<string>::iterator iter;
        for (iter = myHeaders.begin(); iter != myHeaders.end(); iter++)
            generalHeaders.push_back(*iter);
    };
    ~https() {};

    void set_general_headers(const vector<string> &myHeaders)
    {
        vector<string>::iterator iter;
        for (iter = myHeaders.begin(); iter != myHeaders.end(); iter++)
            generalHeaders.push_back(*iter);
    };

    void add_header(const string &aHeader)
    {
        generalHeaders.push_back(aHeader);
    }

    
    string https_request(const string& httpMethod, 
                         const string& url) const;

    string https_request(const string& httpMethod, 
                         const string& url,
                         const vector<string>& customHeaders,
                         const user_data& userData) const;

    string https_request(const string& httpMethod, 
                         const string& url,
                         const vector<string>& customHeaders) const;

    string https_request(const string& httpMethod, 
                         const string& url,
                         const user_data& userData) const;

private:
    static size_t write_to_buf(char* data, 
                               size_t size, 
                               size_t nmemb,
                               string* buffer);

}





#endif
